﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Domain.MainModule.Entities;
using Infraestructure.Data.MainModule.UnitOfWork;
using Infraestructure.CrossCutting.Logging;
using Domain.MainModule.GroupBranchCurrencies;
using Infraestructure.Data.MainModule.Repositories;

namespace Infraestructure.Data.MainModule.Tests.RepositoriesTests
{
    /// <summary>
    ///This is a test class for GroupBranchCurrencyRepositoryTest and is intended
    ///to contain all GroupBranchCurrencyRepositoryTest Unit Tests
    ///</summary>
    [TestClass()]
    public class GroupBranchCurrencyRepositoryTest : RepositoryTestsBase<GroupBranchCurrency>
    {
       public override System.Linq.Expressions.Expression<Func<GroupBranchCurrency, bool>> FilterExpression
        {
            get { return a => a.GroupBranchCurrencyId == TestConstants.Instance.GROUP_BRANCH_CURRENCY_ID; }
        }

        public override System.Linq.Expressions.Expression<Func<GroupBranchCurrency, Guid>> OrderByExpression
        {
            get { return a => a.GroupBranchCurrencyId; }
        }

        /// <summary>
        ///A test for FindGroupBranchCurrency
        ///</summary>
        [TestMethod()]
        public void FindGroupBranchCurrencyById_Invoke_Test()
        {
            //Arrange 
            IMainModuleUnitOfWork context = GetUnitOfWork();
            ITraceManager traceManager = this.GetTraceManager();
            IGroupBranchCurrencyRepository repository = new GroupBranchCurrencyRepository(context, traceManager);

            GroupBranchCurrencyIdSpecification spec = new GroupBranchCurrencyIdSpecification(TestConstants.Instance.GROUP_BRANCH_CURRENCY_ID);

            //Act
            GroupBranchCurrency groupBranchCurrency = repository.FindGroupBranchCurrency(spec);

            //Assert
            Assert.IsNotNull(groupBranchCurrency);
        }

        /// <summary>
        ///A test for FindGroupBranchCurrency
        ///</summary>
        [TestMethod()]
        public void FindGroupBranchCurrencyByCurrencyId_Invoke_Test()
        {
            //Arrange 
            IMainModuleUnitOfWork context = GetUnitOfWork();
            ITraceManager traceManager = this.GetTraceManager();
            IGroupBranchCurrencyRepository repository = new GroupBranchCurrencyRepository(context, traceManager);

            GroupBranchCurrencyIdSpecification spec = new GroupBranchCurrencyIdSpecification(TestConstants.Instance.GROUP_BRANCH_CURRENCY_CURRENCY_ID);

            //Act
            IEnumerable<GroupBranchCurrency> groupBranchCurrency = repository.FindGroupBranchCurrencies(spec);

            //Assert
            Assert.IsNotNull(groupBranchCurrency);
        }
    }
}
